<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>欢迎访问！</title>
  <link rel="stylesheet" type="text/css" href="css/newLogin.css">
  <link rel="stylesheet" type="text/css" href="css/loading.css">

  <script src="js/jquery-1.8.0.js"></script>
  <script>
    $(function (){
      $("#btn_ipt").click(function (event){
        $("#loading").css("display","block");
        event.preventDefault();//阻止表单的默认提交行为
        $.ajax({
          url:"LoginServlet",
          type:"post",
          data:{flag:"login",adminName:$("#adminName").val(),password:$("#password").val()},
          success:function (data){
            $("#loading").css("display", "none");
            if(data=="0"){
              alert("账号或密码错误,登录失败");
            }
            else if(data=="2"){
              alert("账号已被锁定,请联系管理员");
            }
            else{
              window.location.href="main.html";
            }
          }
        });
      });
    });
  </script>
</head>
<body>
<div class="Box">
  <form action="" method="post">
    <h3>注册会计系统(拟)</h3>
    <p class="desc">WELCOME LOGIN</p>
    <input type="text" placeholder="请输入账号" id="adminName" value="abc" required>
    <input type="password" placeholder="请输入密码" id="password" value="123" required>
    <input type="submit" class="loginBtn" value="登录" id="btn_ipt">
    <p class="no">
      <span onclick="alert('我觉得你能想起来')">忘记密码</span>
      <span>没有账号？请联系管理员</span>
    </p>
    <div id="loading" class="semipolar-spinner" style="display:none">
      <div class="ring"></div>
      <div class="ring"></div>
      <div class="ring"></div>
      <div class="ring"></div>
      <div class="ring"></div>
    </div>
  </form>
</div>
</body>
</html>